<script setup lang="ts">
import {ref,reactive,onMounted} from 'vue'

const name = "MiniCard"

//
//
const changeImg = (flag:Boolean) => {
  console.log(flag)
}
const miniCardClick = () => {}

</script>

<template>
  <div class="miniCard"
       @mouseover.stop.prevent="changeImg(true)"
       @mouseout.stop.prevent="changeImg(false)"
       @click="miniCardClick">
    <!--        如果没有遮罩层，鼠标从card元素滑动到img元素时，也会触发changeImg事件-->
    <div class="mask"></div>
    <el-image
        class="img"
        style="width:10px;"
        src="url"
        fit="fill"/>
    <div class="info">
      <div class="name">{{ 'name' }}</div>
      <div class="num">{{ 'num' }}</div>
    </div>
  </div>
<!--  <div class="card">-->
<!--    我是卡片-->
<!--  </div>-->
</template>

<style scoped lang="scss">
.miniCard {
  margin: 10px;
  background-color: white;
  width: 380px;
  height: 120px;
  display: flex;

  .mask {
    position: absolute;
    width: 380px;
    height: 120px;
    z-index: 999;
  }

  .img {
    flex: 1;
    width: 80px;
    height: 80px;
    margin-top: 20px;
    margin-left: 20px;
  }

  //
  .info {
    flex: 2;

    .name {
      color: #8c8c8c;
      margin: 25px 0 10px 90px;
      font-size: 1.2em;
      font-weight: 600;
    }

    .num {
      color: #7e7c7c;
      margin: 0 0 10px 90px;
      font-size: 1.6em;
      font-weight: 800;
    }
  }

  .miniCard:hover {
    box-shadow: 2px 2px 4px 0 rgba(0, 0, 0, 0.2);
  }
}
</style>